package game_control;

import org.gamecontrolplus.ControlDevice;
import org.gamecontrolplus.ControlIO;
import org.gamecontrolplus.ControlSlider;

import processing.core.PApplet;
import processing.core.PFont;

public class ProcontrollTest extends PApplet{

	public PFont font; 

	ControlDevice device;
	ControlSlider slider1;
	ControlSlider slider2;
	ControlSlider slider3;
	ControlSlider slider4;

	ControlIO control;

	public void setup(){
		size(1200, 800,P3D);
		//smooth();
		lights();
		control = ControlIO.getInstance(this);
		  System.out.println(control.devicesToText(""));

//		for(int i = 0; i < controll.getNumberOfDevices();i++){
//			ControlDevice device = controll.getDevice(i);
//			System.out.println("============================================================================");
//			System.out.println("Device number  " + i + " is called " + device.getName() + " and has");
//			System.out.println("\t" + device.getNumberOfButtons() + " buttons");
//			System.out.println("\t" + device.getNumberOfSliders() + " sliders");
//			System.out.println("\t" + device.getNumberOfRumblers() + " rumblers");
//			device.printButtons();
//			device.printSliders();
//			System.out.println("----------------------------------------------------------------------------\n\n");
//		}
		//device = controll.getDevice(0);
		//device.open();
		/**device = controll.getDevice(2);
		 device.tolerance(0.02f);
		 device.open();
		 slider1 = device.getSlider(0);
		 slider1.relation(20);
		 slider2 = device.getSlider(1);
		 slider2.relation(0.05f);
		 slider3 = device.getSlider(2);
		 slider3.relation(0.05f);
		 slider4 = device.getSlider(3);
		 slider4.relation(0.05f);
		 System.out.println("devices:"+controll.getNumberOfDevices());*/
	}


	public void draw(){
		background(255);
		//println(frameRate);
		//		for(int i = 0; i < device.getNumberOfButtons();i++){
		//			println(device.getButton(i).pressed());
		//		}
		//		
		//		for(int i = 0; i < device.getNumberOfSliders();i++){
		//			println(device.getSlider(i).getValue());
		//		}
	}

	static public void main(String[] args){
		PApplet.main(new String[] {ProcontrollTest.class.getName()});
	}
}